1. Field of the Invention
The invention relates to computers and, more specifically, to the processing of pixel values.
2. Description of Related Art
Images displayed on computer monitors are generated by joining many miniature picture elements commonly referred to as pixels. The pixels are represented in a variety of formats. The most common pixel formats are 8-bit, 16-bit, and 24-bit.
The format used varies based upon such factors as the monitor, the graphics card, and the amount of memory intended to be used. Some of the formats are based on a combination of red, green, and blue values. For example, a twenty-four-bit pixel format is typically composed of eight bits of red data, eight bits of green data, and eight bits of blue data. The format is commonly referred to as an 8/8/8 format following Red/Green/Blue, and is a common pixel format used for storing the pixel bits in a memory array.
Not all pixel formats are based on some combination of the colors red, green, and blue. The 8-bit format, for example, is often referred to as a Color Look Up Table (CLUT index). In this case, each 8-bit pixel is an index into an array of 256 arbitrary colors. However, in the remainder of the present application, it will be assumed that pixels are provided as red, green, and blue bits.
Twenty-four-bit pixels, however, are considered to be very expensive for storage and generating images on a color monitor. As a result, there continues to be an abundance of video displays that require 16-bit pixels. As such, when an image represented by twenty-four-bit pixels is input into computer system (e.g., scanned), it is typically compressed into a sixteen-bit pixels before it is stored or can be generated as an image to be displayed on a monitor.
Moreover, the pixels are frequently used in on-line real time video applications, which are very performance-sensitive. Any slowdown in the application could result in slower video playback, less stunning graphics in video games, or some other related detraction from a visual experience. As such, there exist a continuous need to increase the speed of compressing the pixels from 24-bit pixels to 16-bit pixels in order to increase the performance of video applications.
Typically, compressing the 24-bit pixels into 16-bit pixels involves separating the colors of a pixel by copying each color into separate registers. Separate instructions are then used to individually mask each of the colors into target sizes, and separate instructions are again used to individually shift the colors into relative final positions. The colors are then logically OR-ed into one register in order to present a 16-bit pixel.
Advancements in computer architecture, however, provide an ability to process small integer data values more efficiently. More specifically, the advancements include the ability to process multiple small integer data values in parallel in response to a single instruction, otherwise referred to as a Single Instruction Multiple Data, hereinafter referred to as an SIMD. The multiple data elements are joined together as packed data sequences. The packed data sequences provide a single data structure storing of up to sixty-four-bits of integer data in one register, wherein the sequence includes multiple data elements of equal size.
Therefore, what is needed is an accelerated method for compressing 24-bit pixels to 16-bit pixels by using 64-bit packed data sequences and related SIMD instructions, so as to enhance the visual experience of video and related applications.